﻿
Ext.namespace('FantastPlatform', 'FantastPlatform.UI');
FantastPlatform.UI.NoticeForm = function (config) {
    Ext.apply(this, config);

    this.items = [{
        layout: 'column',
        border: false,
        labelSeparator: '：',
        items: [{
            columnWidth: 1,
            border: false,
            layout: 'form',
            items: [new Ext.form.Hidden({
                name: 'CreatePoliceManNumber'                         
                })]
        },
{
    columnWidth: 1,
    border: false,
    layout: 'form',
    items: [new Ext.form.TextField({
        fieldLabel: '标题',
        name: 'Name',
        allowBlank: false,
        blankText: " 标题不能为空",
        width: 360
    })]
},
        {
            columnWidth: 1,
            border: false,
            layout: 'form',
            items: [new Ext.form.TextArea({
                fieldLabel: '通知内容',
                name: 'Content',
                allowBlank: false,
                blankText: " 通知内容不能为空",
                height: 150,
                width: 360
            })]
        }]
    }];

    FantastPlatform.UI.NoticeForm.superclass.constructor.call(this, {
        bodyStyle: 'padding:5px',
        collapsible: true,
        labelAlign: 'right',
        autoScroll: true,
        border: false
    });
};

Ext.extend(FantastPlatform.UI.NoticeForm, Ext.form.FormPanel, {
    onRender: function (ct, position) {
        FantastPlatform.UI.NoticeForm.superclass.onRender.call(this, ct, position);
        if (this.NoticeId && this.NoticeId != 0) {
            this.add(new Ext.form.Hidden({ name: 'Id', value: this.NoticeId }));
            this.form.load({
                url: '../Service/NoticeService.aspx?Action=Get',
                params: { id: this.NoticeId },
                waitMsg: '正在读取数据...',
                waitTitle: '请稍后...',
                failure: function (form, action) {
                    if (action.failureType != 'client') {
                        showErrorMessage('操作失败', action.result.message, '');
                    }
                },
                success: function (form, action) {
                   
                    if (form.getValues().CreatePoliceManNumber != policemanNumber&&AdminI!="True") {
                        Ext.getCmp('saveNotice').setDisabled(true);
                        Ext.getCmp('cancelNotice').setDisabled(true);
                        //                        Ext.getCmp('addDetail').setDisabled(true);
                        //                        Ext.getCmp('ChangeCar').setDisabled(true);
                    }
                }
            });
        }
    }
});

